<?php
/**
 * Created by PhpStorm.
 * User: adophper <hello@adophper.com>
 * Date: 2016/12/28
 * Time: 23:25
 */
namespace common\components;

use common\services\SystemServices;
use Yii;
use yii\base\Component;

class System extends Component {

    public $service;

    public function init(){
        parent::init();
    }

    public function title(){
        $service = new SystemServices();
        $result = $service->getSys('site_title');
        return $result['value'];
    }

    public function keywords(){
        $service = new SystemServices();
        $result = $service->getSys('site_keywords');
        return $result['value'];
    }

    public function description(){
        $service = new SystemServices();
        $result = $service->getSys('site_description');
        return $result['value'];
    }

    public function tongji(){
        $service = new SystemServices();
        $result = $service->getSys('tongji');
        return $result['value'];
    }

    public function copyright(){
        $service = new SystemServices();
        $result = $service->getSys('copyright');
        return $result['value'];
    }

    public function telephone(){
        $service = new SystemServices();
        $result = $service->getSys('telephone');
        return $result['value'];
    }

    public function icp(){
        $service = new SystemServices();
        $result = $service->getSys('icp');
        return $result['value'];
    }

    /**
     * 副标题
     * @return \yii\db\ActiveRecord
     */
    public function getSubtitle(){
        $service = new SystemServices();
        $result = $service->getSys('subtitle');
        return $result['value'];
    }

    /**
     * 网站logo
     * @return \yii\db\ActiveRecord
     */
    public function getLogo(){
        $service = new SystemServices();
        $result = $service->getSys('logo');
        return $result['value'];
    }

    /**
     * 首页Logo正文文字说明
     * @return \yii\db\ActiveRecord
     */
    public function getLogoText(){
        $service = new SystemServices();
        $result = $service->getSys('logo-text');
        return $result['value'];
    }

    /**
     * 搜索框提示语
     * @return \yii\db\ActiveRecord
     */
    public function getSearchText(){
        $service = new SystemServices();
        $result = $service->getSys('search-text');
        return $result['value'];
    }

    /**
     * 底部二维码
     * @return \yii\db\ActiveRecord
     */
    public function qrcode(){
        $service = new SystemServices();
        $result = $service->getSys('qrcode');
        return $result['value'];
    }

    /**
     * 根据code获取值
     * @param $code
     * @return \yii\db\ActiveRecord
     */
    public function getValueByCode($code){
        $service = new SystemServices();
        $result = $service->getSys($code);
        return $result['value'];
    }

}